package com.polly.controller;

import com.polly.repository.HomeworkInfoDao;
import domain.HomeworkInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.TimeUnit;

/**
 * @author liqin@nd.com.cn
 * @version V1.0
 * @title: AssignmentController
 * @description: TODO(用一句话描述该文件做什么)
 * @date: 2019/4/8 17:16
 */
@RestController
public class AssignmentController {

    @Autowired
    private HomeworkInfoDao homeworkInfoDao;

    @RequestMapping(value = "/hhomeworks/{homework_id}", method = RequestMethod.GET)
    public String helloHomeworkInfo( @PathVariable(value = "homework_id") String homeworkId) {

        try {
            TimeUnit.MILLISECONDS.sleep(100);
        } catch (InterruptedException e) {

        }
        return homeworkId;
    }

    @RequestMapping(value = "/homeworks/{homework_id}", method = RequestMethod.GET)
    public HomeworkInfo getHomeworkInfo(@PathVariable(value = "homework_id") String homeworkId) {
        return homeworkInfoDao.findHomeworkInfoByHomeworkId(homeworkId);
    }
}
